package com.yst.metho.web.application.utils;

import java.util.Collection;
import java.util.Iterator;

import nextapp.echo2.app.list.AbstractListModel;
import nextapp.echo2.app.list.ListModel;

/**
 * Modele utilise pour representer tous les users affectes au projet.
 * 
 * @author perso
 * 
 */
public class GenericModel extends AbstractListModel implements ListModel
{
	private Collection mList;

	public GenericModel(Collection listUser)
	{
		mList = listUser;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see nextapp.echo2.app.list.ListModel#get(int)
	 */
	public Object get(int index)
	{
		Object retour = null;
		Iterator it = mList.iterator();
		int i = -1;
		do
		{
			retour = it.next();
			i++;
		}
		while (i != index);
		return retour;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see nextapp.echo2.app.list.ListModel#size()
	 */
	public int size()
	{
		return mList.size();
	}

}
